package com.stb.llh.dao;

import com.stb.llh.entity.Emotion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @Author Lee
 * @Date 2021/11/3
 * @Description
 */
public interface EmotionDao extends JpaRepository<Emotion,Integer> {


    @Query(value = "select count(*) from emotion",nativeQuery = true)
    int countAll();


    @Query(value = "select  count(*) from emotion where DATEDIFF(DATE_FORMAT(dates,'%Y-%m-%d'),CURRENT_DATE) = 0 ",nativeQuery = true)
    int countEmotionNow();

    @Query(value = "select  count(*) from emotion where DATEDIFF(DATE_FORMAT(dates,'%Y-%m-%d'),CURRENT_DATE) = -1 ",nativeQuery = true)
    int countEmotionYesterday();


}
